package com.qd.common.panda.domain.entity.stroke;

import com.cdqidi.util.page.BaseQuery;
import com.cdqidi.valid.group.DefaultGroup;
import com.cdqidi.valid.group.DeleteGroup;
import com.cdqidi.valid.group.UpdateGroup;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;

/**
 * 用户行程
 *
 * @author sjk
 */
@EqualsAndHashCode(callSuper = true)
@Getter
@Setter
@Slf4j
@ToString
public class UserStrokeDTO extends BaseQuery {

    /**
     * 主键
     */
    @NotBlank(message = "行程ID不能为空", groups = {DeleteGroup.class, UpdateGroup.class})
    @Size(max = 50, message = "行程ID长度不能超过{max}位", groups = {DeleteGroup.class, UpdateGroup.class})
    private String sid;
    /**
     * 用户昵称
     */
    @Size(max = 200, message = "用户昵称长度不能超过{max}位", groups = DefaultGroup.class)
    private String nickName;
    /**
     * 行程开始时间
     */
    private LocalDateTime startTime;
    /**
     * 预约时间
     */
    private LocalDateTime appointmentTime;
    /**
     * 入场时间
     */
    private LocalDateTime intoTime;
    /**
     * 出场时间
     */
    private LocalDateTime outTime;
    /**
     * 计费开始时间
     */
    private LocalDateTime billStartTime;
    /**
     * 计费结束时间
     */
    private LocalDateTime billEndTime;
    /**
     * 停车时长:单位是秒
     */
    private Long parkTime;
    /**
     * 停车费总额
     */
    private BigDecimal amount;
    /**
     * 停车费总额显示
     */
    private String amountDisplay;
    /**
     * 实际支付总额
     */
    private BigDecimal payAmount;
    /**
     * 实际支付总额显示
     */
    private String payAmountDisplay;
    /**
     * 线上支付总额
     */
    private BigDecimal onLinePayAmount;
    /**
     * 线上支付总额显示
     */
    private String onLinePayAmountDisplay;
    /**
     * 过程状态:0生成订单未入场1预约主动取消2预约超时取消3已入场4已缴费未出场5已出场
     */
    private Integer processStatus;
    /**
     * 过程状态显示
     */
    private String processStatusDisplay;
    /**
     * 行程状态:1开始2结束
     */
    private Integer tripStatus;
    /**
     * 行程状态显示
     */
    private String tripStatusDisplay;
    /**
     * 停车场
     */
    @NotBlank(message = "停车场不能为空", groups = DefaultGroup.class)
    @Size(max = 50, message = "停车场长度不能超过{max}位", groups = DefaultGroup.class)
    private String parkId;
    /**
     * 停车场显示
     */
    private String parkIdDisplay;
    /**
     * 车牌
     */
    @NotBlank(message = "车牌不能为空", groups = DefaultGroup.class)
    @Size(max = 20, message = "车牌长度不能超过{max}位", groups = DefaultGroup.class)
    private String plateNumber;
    /**
     * 用户唯一标识
     */
    @Size(max = 50, message = "用户唯一标识长度不能超过{max}位", groups = DefaultGroup.class)
    private String userId;
    /**
     * 查询时候使用，如果有多个的情况
     */
    private List<Integer> processStatusList;
    /**
     * 门岗名字，多个用分号分隔
     */
    private String doorpostName;
    /**
     * 行程类型:0停车1充电
     */
    private Integer tripType;

    @Override
    public void freeData() {
        this.sid = null;
        this.nickName = null;
        this.startTime = null;
        this.appointmentTime = null;
        this.intoTime = null;
        this.outTime = null;
        this.billStartTime = null;
        this.billEndTime = null;
        this.parkTime = null;
        this.amount = null;
        this.amountDisplay = null;
        this.payAmount = null;
        this.payAmountDisplay = null;
        this.onLinePayAmount = null;
        this.onLinePayAmountDisplay = null;
        this.processStatus = null;
        this.processStatusDisplay = null;
        this.tripStatus = null;
        this.tripStatusDisplay = null;
        this.parkId = null;
        this.parkIdDisplay = null;
        this.plateNumber = null;
        this.userId = null;
        this.doorpostName = null;
        this.tripType = null;
        Optional.ofNullable(processStatusList).ifPresent(List::clear);
        super.freeData();
    }
}
